home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / play / tracker_4_31.lzh / tracker / Docs / technotes < prev    next >
Text File  |  1995-02-23  |  7KB  |  169 lines

  1. These notes are extracted from the protracker 1.2 source and other places.
  2.  
  3. Counter goes 1 .. 2 ... currentspeed ? -> 0
  4. Actual commands occur for counter = 0, effects occur only for counter > 0.
  5. Big difference with Med there, except when in soundtracker compatibility mode.
  6.  
  7. Samples:
  8. usual sample length unit is the 16 bit memory word, except for some real old
  9. tracker tunes, which use bytes for the replay offset ???
  10. Consequently, this should only occur with 15 instruments modules (not checked
  11. for in tracker). The actual check is whether rp_length + rp_offset is greater
  12. than length.  Usual protracker samples are 8-bit signed (dictated by the 
  13. amiga hardware).
  14.  
  15. Finetune:
  16. it seems the stored frequencies are actually notes, i.e., they
  17. always correspond to the base frequency table.
  18. So what you do is convert the frequency to notes as usual, then
  19. use another frequency table according to the finetune setting.
  20.  
  21. Arpeggio 1: on Counter % 3 ,
  22.     0 normal
  23.     1 +HI
  24.     2 +LO
  25.  
  26. Portamento up 1/down 2: there is NO default value. Accordingly, 0 does nothing.
  27. Note that we ensure $71 <= period <= $358. And 0 <= volume <= 64
  28.  
  29. Tone portamento 3/Tone porta+ vol slide 5: work exactly the same way except that
  30. 5 doesn't have a rate, but use the previous rate.
  31. Various cases:
  32. - new note: porta to the new note with the given (or previous) rate.
  33. Start with the current period, not any previous goal or anything.
  34. - no new note: go on tone portamento, unless already finished. If needed,
  35. adjust rate on the fly.
  36.  
  37. Gliss funk E3: snap the actual pitch to the nearest note. Don't store it.
  38.  
  39.  
  40. Fine porta up E1/Fine porta down E2/Fine volume up EA/Fine volume down EB:
  41. do just one change, on setup.
  42.  
  43. Set speed: under protracker, 0 does stop.
  44. < 32 does a normal set counter.
  45. >=32 is a factor to get real speed from (default is 125), except for old
  46. tracker modules.
  47. what to do when there are several set speed command in the same line ?
  48. First, if all set_speed options are in the same mode (<32 for instance),
  49. only the last one applies.
  50. Opinions differs... it seems that even various incarnations of protracker
  51. don't do the same thing. tracker behavior changes according to the speedmode
  52. option:
  53. * old -> all set_speed just do a normal set counter.
  54. * finefirst -> only the >=32 command is heeded.
  55. * normalfirst -> only the < 32 command is heeded, AND finespeed is reset to 125
  56. * normal -> both commands are heeded.
  57. note that protracker behavior states that set_speed(<32) should reset finespeed
  58. to 125.
  59.  
  60.  
  61. Change volume B: the value is pure binary.
  62.  
  63. Volume Slide A: delta = HI - LOW. No default value.
  64. The actual code does: HI == 0 ? -LOW : +HI
  65.  
  66. Sample offset 9: take parameter x 256 and start from there (if
  67. para x 256 >= length, just don't play sample).
  68.  
  69. Note cut EC/ Note Delay ED: occurs when counter = para
  70.  
  71. ---------
  72. Some comments about resampling:
  73. any profiler will tell you that tracker spends most of its time emulating
  74. the amiga hardware in resample.c (except on the amiga, of course).
  75. What can be done to alleviate the problem ?
  76.  
  77. - on any machine that has got hw sufficiently similar to the amiga (at least
  78. four channels and independent replay speed), write routines similar to the
  79. amiga.
  80.  
  81.  
  82. - keep it simple... Even a stupid test might slow the routine down. Hence,
  83. the duplicated code according to oversample, the special `empty' sample with
  84. its special properties (samp->fix_length == 0 && samp->rp_start == NULL).
  85.  
  86. As a consequence, new sample styles (like 16 bit samples) SHOULD be implemented
  87. as new types of commands like DO_NOTHING, PLAY, REPLAY (PLAY16 and REPLAY16
  88. come to mind), even though it WILL duplicate loads of code.
  89.  
  90. Recently, the code has changed to allow for more than four channels. This incurs
  91. a slight overcost (two more additions), which is actually negligible for 
  92. oversampled replay, and has been deemed acceptable for simple replay.
  93.  
  94. The lookup table for converting 0-64 volumes to a linear scale is a cheap way
  95. to allow for all sorts of manipulations on the sample volumes at a low cost,
  96. and also to use n-bit samples in an almost transparent way, even with n not
  97. being an integral multiple of 8.
  98.  
  99.  
  100.  
  101.  
  102. If your machine is REALLY slow, and uses ulaw, computing a complete lookup
  103. table (all 16384 values of it) might speed things up somewhat. Removing the
  104. oversampling test altogether might do it also. Then you can unroll the
  105. for(i = 0; i < number; i++) loop, not initialising value[LEFT_SIDE] and
  106. value[RIGHT_SIDE] to 0, but giving them their initial real value.
  107. If all that fails, you can still find a better compiler, check whether your
  108. audio bandwidth is not too limited, downgrading the audio output to a lower
  109. acceptable frequency (stuttering and outputting several times the same 
  110. sample is possible). Lastly, you can still go to assembly language...
  111.  
  112. Some optimization has been added to resample/audio.c. Basically, I've checked
  113. where tracker was spending time, and I discovered that ALMOST all the time 
  114. was spent doing divisions/multiplications, like for primary, secondary.
  115. Instead of computing:
  116. realLeft = left*primary + right*secondary
  117. realRight = right*primary + left*secondary,
  118.  
  119. doing
  120. sum = (left+right) * (primary+secondary)/2
  121. diff = (left-right) * (primary-secondary)/2
  122. realLeft = sum+diff
  123. realRight = sum-diff
  124.  
  125. gains two multiplications ! Just realize that (primary+secondary)/2 and
  126. (primary-secondary)/2 don't change and can be precomputed.
  127.  
  128. Apart from primitive architectures where multiplication and addition costs
  129. are the same, this gains a lot. On a sparc 5, I can now use -over 2 -freq 44 !
  130.  
  131. The `Next Generation' will probably be output-size aware and not compute
  132. 23 bits systematically, but ask what resolution the audio output uses,
  133. and output left/right samples with a given number of bits, stating the
  134. number of bits at the same time.
  135.  
  136. ---------
  137. Amiga HW details:
  138.  
  139. Since part of the behavior of soundtracker-like programs depend heavily on the
  140. amiga audio hardware, it is only suitable that there be a description of this
  141. hardware here.
  142.  
  143. The amiga has four completely independant audio channels, numbered from 0 to 3.
  144. Channel 0 and 3 are connected to the left-side stereo output, 1 and 2 to 
  145. the right-side---hence the strange numbering in soundtracker programs.
  146.  
  147. Sound data is 8 bit signed in standard 2 complement (-128<=v<=127).
  148.  
  149. The volume is also set independently from 0 to 64 (0<=v<=64). 
  150. There is no typo there ! In terms of the hardware, the 64 value means that the
  151. hardware dampening is disconnected.
  152. The volume is linear. Sample values as follows:
  153. Volume   db
  154. ---------------
  155. 64       0
  156. 48       -2.5
  157. 32       -6.0
  158. 16       -12.0
  159.  
  160. The sampling period is limited by the number of DMA cycles allocated to an 
  161. audio channel, and traditionally linked to the video frequency. The formulas 
  162. are of little interest. The result is used in notes.c for instance.
  163.  
  164. Finally, the amiga features a low-pass filter that can be disconnected through
  165. software. The filter becomes active around 4KHz and gradually begins to attenuate
  166. the signal. Generally, you cannot hear frequencies higher than 7KHz.
  167. Most soundtrackers disable the low-pass filter, and use it only for special
  168. effects.
  169.